// 宿舍楼表模拟数据
require("../models/relation")
const mock = require("mockjs")
const {Dormitory} = require("../models/Dormitory")
const {RoomRate} = require("../models/RoomRate")

const arr = [100,0,0,0,0,0]



const DormitoryList = mock.mock({
    "datas|6":[
        {
            "DormitoryName":"@ctitle(3,4)", // 宿舍楼名称
            "floorNum|1":[5,6,4],   // 一共几层
            "roomNum|1":[24,20,18], // 每层房间数
            "fewPeople|1":[4,6], //每间房的人数
            "dormitoryCapacity": 0, // 容纳数
            "dormitoryresided|+1": arr, // 以住人数
        }
    ]
}).datas
DormitoryList.map(i=>{
    i.dormitoryCapacity = i.floorNum * i.roomNum * i.fewPeople
    i.RoomRateId = i.fewPeople === 4 ? 1 : 2
})


Dormitory.bulkCreate(DormitoryList).then(data => {
    console.log(data);
})


